<?php
    include '../../JHeader.php';

    if(isset($_GET['id']))
    {
        require_once '../../Database/Database.php';
        $series_id = $_GET['id'];

        $db = new Database();
        $db->Connect();
        $series = $db->Select('Series', 'ID_Series = ' . $series_id);

        if($series)
        {
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Strecke hinzufügen | <?php echo $series[0]->Name ?></title>
    </head>
    <body>
      <form name="add_track" method="POST" action="<?php echo $_SERVER['SELF'] ?>">
          <table>
            <tr>
                <td>Name der Strecke</td>
                <td>
                    <input type="text" name="trackname" size="25" maxlength="50" />
                </td>
                <td id="check_name"></td>
            </tr>
            <tr>
                <td>Ort</td>
                <td>
                    <input type="text" name="location" size="25" maxlength="50" />
                </td>
                <td id="check_loc"></td>
            </tr>
            <tr>
                <td>Länge der Strecke</td>
                <td>
                    <input type="text" name="length" size="25" maxlength="50" />
                </td>
                <td id="check_length"></td>
            </tr>
            <tr>
                <td><input type="submit" value="Strecke hinzufügen"></td>
                <td></td>
                <td></td>
            </tr>
          </table>
       </form>
    </body>
</html>
<?php
        }
        else
        {
            echo 'Ung&uuml;ltige Serien ID.';
        }
    }
    else
    {
        echo 'ERROR';
    }
?>